A semiconductor device including gate electrodes stacked in a direction perpendicular to a surface of a semiconductor substrate has been developed. For high integration of a semiconductor device, the number of gate electrodes, having been stacked, has been increased. As described above, as the number of gate electrodes, stacked in a direction perpendicular to a surface of a semiconductor substrate, increases, a degree of difficulty of a gate forming process gradually increases, and unexpected defects occur.